package com.bailanzu.tool;

public class ToneScissorClothImpl implements ToneScissorCloth {
    @Override
    public int gameStandard(String person, int computer) {
       int result=0;//1代表人赢了，2代表人输了
        switch (computer)
        {
            case 1:
                    System.out.println("电脑出的是剪刀");
                    if (person.equals("剪刀"))
                    {
                        System.out.println("平局");
                    }
                    else if (person.equals("石头")){
                        System.out.println("你赢了！");
                        result=1;
                    }
                    else if (person.equals("布"))
                    {
                        System.out.println("你输了！");
                        result=2;
                    }
               break;
            case 2:
                System.out.println("电脑出的是石头");
                if (person.equals("剪刀"))
                {
                    System.out.println("你输了！");
                    result=2;

                }
                else if (person.equals("石头")){
                    System.out.println("平局");

                }
                else if (person.equals("布"))
                {
                    System.out.println("你赢了！");
                    result=1;
                }
                break;
            case 3:
                System.out.println("电脑出的是布");
                if (person.equals("剪刀"))
                {
                    System.out.println("你赢了！");
                    result=1;

                }
                else if (person.equals("石头")){
                    System.out.println("你输了！");
                    result=2;



                }
                else if (person.equals("布"))
                {
                    System.out.println("平局");
                }
                break;
            default:
                System.out.println("请按提示输入");
                break;
        }



        return result;
    }
}
